using System;

namespace GGameFramework.Core.Pool
{
    /// <summary>
    /// 对象池统计信息
    /// </summary>
    public class PoolStatistics
    {
        public int TotalSpawned;
        public int TotalRecycled;
        public int MaxConcurrent;
        public int PoolOverflows;
    }
    
    /// <summary>
    /// 基础对象池接口
    /// </summary>
    public interface IObjectPool
    {
        /// <summary>
        /// 对象池中的对象类型
        /// </summary>
        Type PoolType { get; }
        
        /// <summary>
        /// 对象池当前大小
        /// </summary>
        int Count { get; }
        
        /// <summary>
        /// 对象池容量
        /// </summary>
        int Capacity { get; }
        
        /// <summary>
        /// 获取对象池统计信息
        /// </summary>
        PoolStatistics Statistics { get; }
        
        /// <summary>
        /// 清空对象池
        /// </summary>
        void Clear();
    }
    
    /// <summary>
    /// 引用类型对象池接口（用于任何引用类型对象）
    /// </summary>
    public interface IReferencePool<T> : IObjectPool where T : IReference
    {
        /// <summary>
        /// 从对象池获取对象
        /// </summary>
        T Spawn();
        
        /// <summary>
        /// 回收对象到对象池
        /// </summary>
        void Recycle(T obj);
    }
    
    /// <summary>
    /// GameObject对象池接口（专门用于Unity GameObject）
    /// </summary>
    public interface IGameObjectPool<T> : IObjectPool where T : GameObjectPoolable
    {
        /// <summary>
        /// 从对象池获取对象
        /// </summary>
        T Spawn();
        
        /// <summary>
        /// 回收对象到对象池
        /// </summary>
        void Recycle(T obj);
    }
}